package org.lewis.man.controllers;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.lewis.common.Constants;

import com.tocersoft.framework.core.annotations.Controller;
import com.tocersoft.framework.web.HttpUtils;
import com.tocersoft.framework.web.WebUtils;
import com.tocersoft.framework.web.annotations.Mapping;
import com.tocersoft.framework.web.annotations.NameSpace;
import com.tocersoft.framework.web.renderer.Renderer;

/**
 * 账户登出
 * 
 * @author taiqichao
 * 
 */
@Controller
@NameSpace("/accounts")
public class AccountLoginOutController {

	Log log = LogFactory.getLog(AccountLoginOutController.class);

	@Mapping("/loginout")
	public Renderer loginout() throws Exception {
		
		HttpUtils.removeCookie(Constants.CLIENTAUTHCOOKIEKEY);

		WebUtils.getSession().removeAttribute(Constants.CURRENTUSER);
		
		WebUtils.getResponse().sendRedirect(HttpUtils.getContentPath()+"/");
		
		return null;
	}
}
